//
//  WDGoutWaitVehicleBottomView.m
//  wd-serviceapp
//
//  Created by Bin Tang on 2024/8/14.
//

#import "WDGoutWaitVehicleBottomView.h"


@interface WDGoutWaitVehicleBottomView ()
@property (nonatomic ,strong) UIButton *btnLeft;
@property (nonatomic ,strong) UIButton *btnRight;
@end

@implementation WDGoutWaitVehicleBottomView

- (void)initWithSubView {
    
    self.backgroundColor = [UIColor whiteColor];
    
    [self initWithBtnLeft];
    
    [self initWithBtnRight];
}

- (void)initWithBtnLeft {
    if (!_btnLeft) {
        CGRect frame = CGRectMake(20, 2, (self.width - 40 - 30) * 0.5, 40);
        _btnLeft = [UIButton createWithButton:self frame:frame font:[UIFont systemFontOfSize:14 weight:UIFontWeightRegular] target:self action:@selector(actionWithLeft:) propertiesBlock:^(UIButton * _Nonnull button) {
            button.backgroundColor = [UIColor colorWithHexString:@"#F5F5F5"];
            [button setTitle:@"左边" forState:UIControlStateNormal];
            [button setTitleColor:kThemeColor forState:UIControlStateNormal];
            button.layer.cornerRadius = 5;
            button.layer.masksToBounds = YES;
        }];;
    }
}

- (void)initWithBtnRight {
    if (!_btnRight) {
        CGRect frame = CGRectMake(self.btnLeft.right + 30, 2, (self.width - 40 - 30) * 0.5, 40);
        _btnRight = [UIButton createWithButton:self frame:frame font:[UIFont systemFontOfSize:14 weight:UIFontWeightRegular] target:self action:@selector(actionWithRight:) propertiesBlock:^(UIButton * _Nonnull button) {
            button.backgroundColor = kThemeColor;
            [button setTitle:@"右边" forState:UIControlStateNormal];
            [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
            button.layer.cornerRadius = 5;
            button.layer.masksToBounds = YES;
        }];;
    }
}

- (void)actionWithLeft:(id)sender {
    if (self.viewBlock) {
        self.viewBlock(@"left");
    }
}

- (void)actionWithRight:(id)sender {
    if (self.viewBlock) {
        self.viewBlock(@"right");
    }
}

- (void)setHiddenLeft:(BOOL)hiddenLeft {
    self.btnLeft.hidden = hiddenLeft;
}

- (void)setHiddenRight:(BOOL)hiddenRight {
    self.btnRight.hidden = hiddenRight;
}

- (void)setBtnLeftTitle:(NSString *)btnLeftTitle {
    [_btnLeft setTitle:btnLeftTitle forState:UIControlStateNormal];
}

- (void)setBtnRightTitle:(NSString *)btnRightTitle {
    [_btnRight setTitle:btnRightTitle forState:UIControlStateNormal];
}


@end
